{% extends "base/admin.html" %}

{% block title %}访问点击记录{% endblock %}

{% block head %}
    <!-- Data Tables -->
    <link href="/static/admin/css/plugins/dataTables/dataTables.bootstrap.min.1.10.16.css" rel="stylesheet">    
{% endblock %}

{% block content %}
        {% set data = g.api.sys_get_clicklog() %}
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>访问点击记录<small>&nbsp;最近<code>{{ data|length }}</code>条</small></h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-clicklog">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>URL</th>
                                    <th>agent</th>
                                    <th>方法</th>
                                    <th>IP</th>
                                    <th>状态</th>
                                    <th>来源</th>
                                    <th>地区</th>
                                    <th>终端</th>
                                    <th>设备</th>
                                    <th>操作系统</th>
                                    <th>浏览器</th>
                                </tr>
                            </thead>
                            <tfoot>
                                <tr>
                                    <th>ID</th>
                                    <th>URL</th>
                                    <th>agent</th>
                                    <th>方法</th>
                                    <th>IP</th>
                                    <th>状态</th>
                                    <th>来源</th>
                                    <th>地区</th>
                                    <th>终端</th>
                                    <th>设备</th>
                                    <th>操作系统</th>
                                    <th>浏览器</th>
                                </tr>
                                </tr>
                            </tfoot>
                            <tbody>
                                {% for log in data %}
                                <tr>
                                    <td>{{ log.id }}</td>
                                    <td width="250px" style="word-break:break-all;text-align:left">{{ log.url.replace(request.url_root, '/') }}</td>
                                    <td>{{ log.agent }}</td>
                                    <td>{{ log.method }}</td>
                                    <td>{{ log.ip }}</td>
                                    <td>{% if log.status_code|int == 200 %}<scan class="text-success">200</scan>{% else %}{{ log.status_code }}{% endif %}</td>
                                    <td width="180px" style="word-break:break-all;text-align:left">{{ log.referer }}</td>
                                    <td>{{ log.isp }}</td>
                                    <td>{{ log.browserType }}</td>
                                    <td>{{ log.browserDevice }}</td>
                                    <td>{{ log.browserOs }}</td>
                                    <td>{{ log.browserFamily }}</td>
                                </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
{% endblock %}


{% block script %}
    <!-- Data Tables -->
    <script src="/static/admin/js/plugins/dataTables/jquery.dataTables.min.1.10.16.js"></script>
    <script src="/static/admin/js/plugins/dataTables/dataTables.bootstrap.min.1.10.16.js"></script>
    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function () {
            $('#dataTables-clicklog').DataTable({
                language: {
                    "lengthMenu": "每页 _MENU_ 条记录",
                    "zeroRecords": "没有找到记录",
                    "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
                    "infoEmpty": "无记录",
                    "infoFiltered": "(从 _MAX_ 条记录过滤)",
                    "search": "搜索",
                    "paginate": {
                        "first": "首页",
                        "previous": "上页",
                        "next": "下页",
                        "last": "末页"
                    },
                },
                "order": [[ 0, "desc" ]]
            });
        });
    </script>
{% endblock %}
